package ai.people.netmon.msgsearch.controller;

import ai.people.netmon.framework.domain.archives.dto.ThirdPartySearchPageResponse;
import ai.people.netmon.framework.domain.searchmsg.request.InformationSearchDetailParamVO;
import ai.people.netmon.framework.domain.searchmsg.request.InformationSearchPageParamVO;
import ai.people.netmon.framework.domain.searchmsg.request.InformationSearchReqVO;
import ai.people.netmon.framework.domain.searchmsg.vo.FbListRespFieldsVO;
import ai.people.netmon.framework.domain.searchmsg.vo.InformationSearchDetailRespVO;
import ai.people.netmon.framework.domain.searchmsg.vo.InformationSearchListRespVO;
import ai.people.netmon.framework.domain.searchmsg.vo.TgListRespFieldsVO;
import ai.people.netmon.framework.model.response.Result;
import ai.people.netmon.msgsearch.domain.entity.FacebookAccountRegisterInfo;
import ai.people.netmon.msgsearch.domain.entity.TelegramAccountRegisterInfo;
import ai.people.netmon.msgsearch.service.IJxSocialMediaRegisterInfoEsSearchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 社交媒体注册信息搜索控制器
 *
 * @author LiGuanNan
 * @date 2022/6/28 16:16
 */
@RestController
@RequestMapping("/v1/social-media-register")
public class JxSocialMediaRegisterInfoSearchController {

    @Autowired
    private IJxSocialMediaRegisterInfoEsSearchService socialMediaRegisterInfoEsSearchService;

    @PostMapping("/facebook-page")
    public Result<ThirdPartySearchPageResponse<InformationSearchListRespVO<FbListRespFieldsVO>>> facebookPage(@Validated @RequestBody InformationSearchReqVO<InformationSearchPageParamVO> reqVo){
        return new Result<>(socialMediaRegisterInfoEsSearchService.queryFbAccountPage(reqVo));
    }

    @PostMapping("/telegram-page")
    public Result<ThirdPartySearchPageResponse<InformationSearchListRespVO<TgListRespFieldsVO>>> telegramPage(@Validated @RequestBody InformationSearchReqVO<InformationSearchPageParamVO> reqVo){
        return new Result<>(socialMediaRegisterInfoEsSearchService.queryTgAccountPage(reqVo));
    }

    @PostMapping("/facebook-detail")
    public Result<InformationSearchDetailRespVO<FacebookAccountRegisterInfo>> facebookDetail(@Validated @RequestBody InformationSearchReqVO<InformationSearchDetailParamVO> reqParam){
        return new Result<>(socialMediaRegisterInfoEsSearchService.fbDetail(reqParam));
    }

    @PostMapping("/telegram-detail")
    public Result<InformationSearchDetailRespVO<TelegramAccountRegisterInfo>> telegramDetail(@Validated @RequestBody InformationSearchReqVO<InformationSearchDetailParamVO> reqParam){
        return new Result<>(socialMediaRegisterInfoEsSearchService.tgDetail(reqParam));
    }

}
